
#ifndef  ___CLINKCTRL_H__20120707___
#define	___CLINKCTRL_H__20120707___	

#include "CommonDef.h"

class CLinkCtrl
{
public:
	CLinkCtrl(INPUT_FIELD_INFO* pFieldInfo);
	virtual ~CLinkCtrl();
	
	virtual DWORD		GetControlType()	= 0;
	virtual CString		GetControlData(BOOL bTrimBlank = TRUE, BOOL bReplaceSingleQuotation = TRUE)	= 0;

	virtual BOOL		CheckCtrlDataValid(){return TRUE;}
	virtual BOOL		CheckDataValidFirst();
	virtual void		ScrollToVisible(){}
	
	void				EnableCustMsgProc(BOOL bCustProc);
	CString				GetCtrlFieldName();
	CString				GetCtrlFieldValue();
	CString				GetBeforeValue(){return m_strBeforeValue;}

	INPUT_FIELD_INFO*	GetFieldInfo(){return m_pInputFieldInfo;}

protected:
	virtual BOOL		OnCtrlKeyDown(UINT nKey){return FALSE;}

	virtual BOOL		PreTranslateMessage(MSG* pMsg, LPVOID pThis);
	virtual void		PreSubclassWindow(LPVOID pThis);

private:
	WNDPROC				GetPrevWndProc(){return m_hOldWindowProc;}

private:
	INPUT_FIELD_INFO*			m_pInputFieldInfo;
	WNDPROC						m_hOldWindowProc;
	CString						m_strBeforeValue;

	static	LRESULT CALLBACK	MainWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

};


#endif//___CLINKCTRL_H__20120707___